#ifndef __SOC_MISC_H__
#define __SOC_MISC_H__

#include <string>
#include <functional>
#include "plat/nonecopyable.h"

/// @brief 
class SOC_Misc : public NoneCopyable
{
public:
    /// @brief 获取CPU频率
    /// @return 
    static uint32_t GetCpuFrequency();
    /// @brief 获取当前CPU 32 位us tick，数据会回绕
    /// @return 
    static uint32_t CurrentCpuUs();
    /// @brief 获取当前CPU ms tick，数据会回绕
    /// @return 
    static uint32_t CurrentCpuMilliseconds();

    /// @brief 硬件延时，一般有os，尽量用os的延时
    /// @param ms 
    static void Delay(uint32_t ms);
    /// @brief 硬件us级别延时，任意us
    /// @param us 
    static void DelayUs(uint32_t us);
    /// @brief 硬件us级别延时，[0-999]
    /// @param us 
    static void DelayUsHighPrecision(uint32_t us);

    static void ResetCpu();
    static std::string GetCpuUID();
    static uint32_t GetFlashSize();

    static void EnableGlobalInterrupt();
    static void DisableGlobalInterrupt();
};

#endif // __SOC_MISC_H__
